var log4js = require("log4js");
log4js.configure({
  appenders: {
    sql: {
      type: "file",
      filename: "./logs/sql.log",
      encoding: "utf-8", //default "utf-8"，文件的编码
      maxLogSize: 1024 * 1024, //文件最大存储空间，当文件内容超过文件存储空间会自动生成一个文件xxx.log.1的序列自增长的文件
      backups: 3,
    },
    http: {
      type: "file",
      filename: "./logs/http.log",
      encoding: "utf-8", //default "utf-8"，文件的编码
      maxLogSize: 1024 * 1024, //文件最大存储空间，当文件内容超过文件存储空间会自动生成一个文件xxx.log.1的序列自增长的文件
      backups: 3,
    },
  },
  categories: {
    default: { appenders: ["sql"], level: "debug" },
    http: { appenders: ["http"], level: "debug" },
  },
});
var sqlLog = log4js.getLogger("sql");
var httpLog = log4js.getLogger("http");

module.exports = { sqlLog, httpLog };
